package jee.boot.entity.auth;

import jee.boot.common.annotation.Column;
import jee.boot.common.annotation.Table;
import jee.boot.common.annotation.Transient;
import jee.boot.entity.system.BasicSbj;
import jee.boot.entity.system.GeneralDataEntity;

/**
 * 原子权限聚合: 角色与原子权限的关联表
 */
@Table(name = "at_r_sbj_auth")
public class SbjAuth extends GeneralDataEntity<SbjAuth> {
    private static final long serialVersionUID = 1L;

    /**
     * 原子权限聚合类型
     */
    @Column(name = "st_r_sbj_auth_type")
    private String sbjAuthType;//字典：
    /**
     * 主体类型
     */
    @Column(name = "st_sbj_type")
    private String sbjType;//字典：DIC_AUTH_AuthSbjType,默认为'DIC_AUTH_AuthSbjType_03'（Role角色）
    /**
     * 主体ID
     */
    @Column(name = "st_sbj_id", joinTable = false)
    private BasicSbj sbj;//引用：AT_USER、AT_GROUP、AT_ROLE,默认引用：AT_ROLE,具体引用哪个表取决于ST_SBJ_TYPE值
    /**
     * 原子权限ID
     */
    @Column(name = "st_authority_id", data = {"authority.id", "authority.no", "authority.code", "authority.name", "authority.desc", "authority.type", "authority.authorityStatus"})
    private Authority authority;//引用：AT_AUTHORITY
    /**
     * 权限与实体关系,里面保存了操作等级
     */
    @Transient
    private AuthEntity authEntity;

    public SbjAuth() {
    }

    public SbjAuth(String id) {
        super(id);
    }

    public SbjAuth(Authority authority) {
        this.authority = authority;
    }

    public String getSbjAuthType() {
        return sbjAuthType;
    }

    public void setSbjAuthType(String sbjAuthType) {
        this.sbjAuthType = sbjAuthType;
    }

    public String getSbjType() {
        return sbjType;
    }

    public void setSbjType(String sbjType) {
        this.sbjType = sbjType;
    }

    public BasicSbj getSbj() {
        return sbj;
    }

    public void setSbj(BasicSbj sbj) {
        this.sbj = sbj;
    }

    public Authority getAuthority() {
        return authority;
    }

    public void setAuthority(Authority authority) {
        this.authority = authority;
    }

    public AuthEntity getAuthEntity() {
        return authEntity;
    }

    public void setAuthEntity(AuthEntity authEntity) {
        this.authEntity = authEntity;
    }
}
